package com.lczyfz.wisdom.modules.platform.baseweb;

import com.lczyfz.wisdom.common.utils.ResponseCode;
import com.lczyfz.wisdom.common.utils.ServerResponse;
import com.lczyfz.wisdom.modules.platform.wxutils.WeiXinUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * Create by css on 2019/10/2
 */
@RestController
@RequestMapping(value = "${apiPath}/puser/pUser")
public class WxController {
    /**
     * 获取单个关注微信的用户信息
     * @param openid
     */
    @RequestMapping(value = "getWxUserInfo",method = RequestMethod.GET)
    public ServerResponse getWxUserInfo(@RequestParam(value = "openid") String openid){
        String wxUserInfo = WeiXinUtils.getWxUserInfo(openid);
        System.out.println(wxUserInfo);
        //province
        //city
        //sex
        return new ServerResponse(ResponseCode.SUCCESS.getCode(),"成功", wxUserInfo);
    }

    /**
     * 获取关注微信的用户信息
     */
    @RequestMapping(value = "getAllUserInfo",method = RequestMethod.GET)
    public ServerResponse getAllUserInfo(){
        String wxUserInfo = WeiXinUtils.allUserInfo();
        return new ServerResponse(ResponseCode.SUCCESS.getCode(),"成功",wxUserInfo);
    }
}
